
<div class="row">
    <div class="container-fluid">
        <div class="col-lg-12 no-padding">
            <section class="content-header">
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                    <li><a href="#" class="active">已拒绝的下载</a></li>
                </ol>
            </section>
            <!-- Main content -->
            <section class="content">
                <div class="row">
                    <div class="col-lg-12 no-padding">
                        <div class="jax-box jax-box-table">
                            <div id="toolbar">
                                <div class="btn-group">
                                    <a class="btn btn-dropbox" href="javascript:window.history.back()">
                                        <i class="fa fa-mail-reply"></i>
                                        返回
                                    </a>

                                </div>
                            </div>
                            <table id="table" class="table table-striped">

                            </table>
                        </div>
                    </div>
                </div>
            </section>

        </div>
    </div>
</div>
<script>
    var checkToPass = "[[${@perms.hasPerm('download:check_ok')}]]";//通过

    /* // 查询、表格 Start*/
    $(function () {
        window.operateEvents  = {
            //审核 通过/
            'click .btn_yes': function (e, value, row, index) {
                let id = row.id;
                layer.prompt({
                    formType: 2,
                    value: ' ',
                    title: '输入备注信息（可选）',
                    area: ['250px', '100px'] //自定义文本域宽高
                }, function(val, index, elem){
                    layer.close(index);
                    Core.postAjax("/download/check/",JSON.stringify({
                        "id":id,
                        "status":1,
                        "checkRemark":val.trim()
                    }),function (data) {
                        if(data["data"]){
                            layer.msg("操作成功",{time:1000},function () {
                                $(e.target).parents("td").css("color","green").html("已通过");
                            });
                        }else {
                            layer.msg("操作失败！")
                        }
                    },"put","application/json");

                });

            }

        };
        let columns = [
            /*{checkbox: true ,
                field : 'checked'},*/
            {
                field: 'downloadNumber',
                title: '申请ID',
                width:60,
                align:"center"
            }
            ,
            {

                title: '文件',
                align:"left",
                formatter:function (value, row, index) {
                    var rs = (
                        row['fileInfoList'].map(function (value,i) {
                            return value['fileName']+"<br>";
                        })
                    ).join("");
                    return rs;
                },

            },
            {
                title: '申请人/时间',
                align:"center",
                formatter:function (value, row, index) {
                    return  (row.applicationName+"/"+row.applicationTime);
                },
                width:160,
            },{
                title: '审核人/时间',
                align:"center",
                formatter:function (value, row, index) {
                    return  (row.status!=0?(row.checkerName+"/"+row.checkTime):"");
                },
                width:160,
            },
            {
                field: 'status',
                title: '操作',
                width: 120,
                align:"center",
                formatter:function (value, row, index) {
                    var rs =  '<a href="javascript:void(0)" ' //+ (value == 2 ? "style='color:red'" : "")
                        + (row.checkRemark ? ('data-toggle="tooltip" data-placement="top" title="' + row.checkRemark) : "")// 审核备注
                        + '">'
                      //  + "<i class=\"fa " + (value == 1 ? "fa-check" : "fa-close") + "\"></i>" //图标
                        + "备注" //文字内容
                        + '<a/>';
                    var btnOK = (checkToPass=="true"?' <a  class="table-btn table-btn-success btn_yes" href="javascript:;">修改-通过</a>':"");
                    return rs + btnOK;
                },
                events:window.operateEvents
            }

        ];
        let options={
            id:"#table",
            url: '/download/list-check',
            method:'get',
            columns:columns,
            showRefresh: true,
            toolbar:"#toolbar",
            //  sortable:true,
            pageList: "[10, 25, 50, 100, all]",
            queryParams : queryParams
        }
        Core.initTable(options);

        /*查询参数*/
        function queryParams(params) {
            return {
                limit : params.limit, //页面大小
                pageNo : (params.offset/params.limit)+1, //页码
                status:2
            };
        }
    });
    /* // 查询、表格 End */



</script>
